/*
 * Licensed to The Apereo Foundation under one or more contributor license
 * agreements. See the NOTICE file distributed with this work for additional
 * information regarding copyright ownership.
 *
 *
 * The Apereo Foundation licenses this file to you under the Educational
 * Community License, Version 2.0 (the "License"); you may not use this file
 * except in compliance with the License. You may obtain a copy of the License
 * at:
 *
 *   http://opensource.org/licenses/ecl2.txt
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
 * License for the specific language governing permissions and limitations under
 * the License.
 *
 */

// Button mixin
@mixin btn($color) {
    font-family: $font-stack;
    border-radius: $main-border-radius;
    color: #fff;
    padding: 5px 10px;
    position: relative;

    @if $color == green-dark-bg {
        box-shadow: inset 0px 1px 0px 0px $primary-color-green-light-1, 0px 2px 3px 1px rgba(0,0,0,.05);

        @include linear-gradient($primary-color-green, $primary-color-green-dark-1);

        border: $thin-border-stroke $dark-bg-border-color;

        &:hover {
            cursor: pointer;
            @include linear-gradient($primary-color-green-light-1, darken($primary-color-green-dark-2, 5%));
        }

        &:focus {
            cursor: pointer;
            @include linear-gradient($primary-color-green-light-1, darken($primary-color-green-dark-2, 5%));
        }

        &:active {
            cursor: pointer;
            box-shadow: inset 0px 3px 10px 1px $primary-color-green-dark-2;
            background-color: $primary-color-green-dark-1 !important;
        }
    }

    @else if $color == blue-dark-bg {
        box-shadow: inset 0px 1px 0px 0px #456c8e, 0px 2px 3px 1px rgba(0,0,0,.05);

        @include linear-gradient(#3a5e7e, #2c9966);

        border: $thin-border-stroke $dark-bg-border-color;

        &:hover {
            cursor: pointer;
            @include linear-gradient(lighten(#3a5e7e, 5%), darken(#2c9966, 10%));
        }

        &:focus {
            cursor: pointer;
            @include linear-gradient(lighten(#3a5e7e, 5%), darken(#2c9966, 10%));
        }

        &:active {
            cursor: pointer;
            box-shadow: inset 0px 3px 10px 1px darken(#2c9966, 3%);
        }
    }

    @else if $color == green {
        box-shadow: inset 0px 1px 0px 0px $primary-color-green-light-1, 0px 2px 3px 1px rgba(0,0,0,.05);

        @include linear-gradient($primary-color-green, $primary-color-green-dark-1);

        border: $thin-border-stroke $primary-color-green-dark-3;

        &:hover {
            cursor: pointer;
            @include linear-gradient($primary-color-green-light-1, darken($primary-color-green-dark-2, 10%));
        }

        &:focus {
            cursor: pointer;
            @include linear-gradient($primary-color-green-light-1, darken($primary-color-green-dark-2, 10%));
        }

        &:active {
            cursor: pointer;
            box-shadow: inset 0px 3px 10px 1px $primary-color-green-dark-2;
            background-color: $primary-color-green-dark-1 !important;
        }
    }

    @else if $color == blue {
        box-shadow: inset 0px 1px 0px 0px #456c8e, 0px 2px 3px 1px rgba(0,0,0,.05);

        @include linear-gradient(#3a5e7e, #2c9966);

        border: $thin-border-stroke $dark-bg-border-color;

        &:hover {
            cursor: pointer;
            @include linear-gradient(darken(#3a5e7e, 1%), darken(#2c9966, 10%));
        }

        &:focus {
            cursor: pointer;
            @include linear-gradient(darken(#3a5e7e, 1%), darken(#2c9966, 10%));
        }

        &:active {
            cursor: pointer;
            box-shadow: inset 0 3px 10px 1px darken(#2c9966, 3%);
        }
    }

    @else if $color == lightblue {

        box-shadow: inset 0px 1px 0px 0px lighten(#388ed6, 10%), 0px 2px 3px 1px rgba(0,0,0,.05);

        @include linear-gradient(#388ed6, #2b77b9);

        border: $thin-border-stroke darken(#2b77b9, 5%);

        &:hover {
            cursor: pointer;
            @include linear-gradient(lighten(#388ed6, 10%), darken(#2b77b9, 10%));
        }

        &:focus {
            cursor: pointer;
            @include linear-gradient(lighten(#388ed6, 10%), darken(#2b77b9, 10%));
        }

        &:active {
            cursor: pointer;
            box-shadow: inset 0px 3px 10px 1px darken(#2b77b9, 5%);
        }
    }

    @else if $color == brightblue {

        box-shadow: inset 0px 1px 0px 0px lighten(#55cef2, 10%), 0px 2px 3px 1px rgba(0,0,0,.05);

        @include linear-gradient(#55cef2, #4da1f7);

        border: $thin-border-stroke darken(#4da1f7, 10%);

        &:hover {
            cursor: pointer;
            @include linear-gradient(lighten(#55cef2, 5%), darken(#4da1f7, 10%));
        }

        &:focus {
            cursor: pointer;
            @include linear-gradient(lighten(#55cef2, 5%), darken(#4da1f7, 10%));
        }

        &:active {
            cursor: pointer;
            box-shadow: inset 0px 3px 10px 1px darken(#4da1f7, 5%);
        }
    }

    @else if $color == red {
        box-shadow: inset 0px 1px 0px 0px lighten($alt-red, 10%), 0px 2px 3px 1px rgba(0,0,0,.05);

        @include linear-gradient(lighten($alt-red, 5%), darken($alt-red, 5%));

        border: $thin-border-stroke darken($alt-red, 20%);

        &:hover {
            cursor: pointer;
            border: $thin-border-stroke darken($alt-red, 30%);
            @include linear-gradient(lighten($alt-red, 10%), darken($alt-red, 10%));
        }

        &:focus {
            cursor: pointer;
            border: $thin-border-stroke darken($alt-red, 30%);
            @include linear-gradient(lighten($alt-red, 10%), darken($alt-red, 10%));
        }

        &:active {
            cursor: pointer;
            box-shadow: inset 0px 3px 10px 1px darken($alt-red, 5%);
        }
    }

    @else if $color == white {

        @include linear-gradient(#fff, #f7f7f7);
        border: $thin-border-stroke $main-border-color;
        box-shadow: inset 0px 1px 0px 0px #fff, 0px 1px 2px rgba(0,0,0,.05);
        outline: none;
        color: $medium-prim-color;
        text-shadow: 0px 1px 0px #fff;

        &:hover {
            cursor: pointer;
            border: $thin-border-stroke darken($main-border-color, 2%);
            @include linear-gradient(darken(#fff, 4%), darken(#f7f7f7, 10%));
            color: $medium-prim-color;
        }

        &:focus {
            cursor: pointer;
            border: $thin-border-stroke darken($main-border-color, 2%);
            @include linear-gradient(darken(#fff, 4%), darken(#f7f7f7, 10%));
            color: $medium-prim-color;
        }

        &:active {
            cursor: pointer;
            box-shadow: inset 0px 1px 6px 2px rgba(0,0,0,.1);
        }
    }

    > i {
        display: inline-block;
        margin-right: 10px;
    }
}

// Standard button styles
button {
    height: $btn-height;
    min-width: 120px;
    font-size: 12px;
    font-weight: 600;
    color: #fff;
    border-radius: $main-border-radius;
    display: inline-block;
}

// Exception for datetimepicker
.ui-datepicker-buttonpane {
  button {
    height: initial;
    min-width: initial;
  }
}

// Buttons
.add-btn {
    @include btn(green);
    display: inline;

    // Circle button
    &.circle-btn {
        border-radius: 50%;
        display: inline-block;
        padding: 0;
        width: 24px;
        height: 24px;

        > i {
            position: absolute;
            top: 7px;
            left: 7px;
        }
    }
}

.cancel-btn {
    @include btn(white);
}

.blue-btn {
    @include btn(lightblue);
}

.red-btn,
.danger-btn {
    @include btn(red);
}
